<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>

    <script>

        // 单例模式：一个类 只有一个实例

        class Demo {
            constructor() {
                console.log(6);
            }
        }


        let d = null ;

        function single() {
           if(!d) {
                d = new Demo
           } 
           return d
        }

        
        

        const d1 = single() ;

        const d2 = single() ;

        console.log(d1 === d2);
        




        // 实现一个自定义弹窗的功能
        //    创建标签


      

    </script>
    
</body>
</html>